<?php
namespace app\admin\model;

use think\Db;
use think\Model;

class User extends BaseModel
{
	public function get_pageList($where){
        return $this->alias("a")
            ->join("ysy_user_info b","a.id = b.user_id","LEFT")
            ->join("ysy_level l","a.level_id = l.id","LEFT")
            ->field("a.id,a.account,a.phone,a.nickname,a.login_time,l.level,b.all_num")
            ->where($where)
            ->order("a.add_time desc")
            ->paginate();
    }

    public function get_agentList($where){
        return $this->alias("a")
            ->join("ysy_user_info b","a.id = b.user_id","LEFT")
            ->join("ysy_level l","a.level_id = l.id","LEFT")
            ->join("ysy_agent d","a.agent_id = d.id","LEFT")
            ->join("ysy_depot e","e.user_id = a.id","LEFT")
            ->join("ysy_user f","b.parent_id = f.id","LEFT")
            ->field("a.id,a.account,a.phone,a.nickname,a.login_time,a.status,l.level,d.agent,b.straight_num,b.all_num,b.money,b.cash,e.money as huomoney,e.amount,f.nickname as upname,f.phone as upphone")
            ->where($where)
            ->order("a.add_time desc")
            ->paginate();
    }

}